package controller.states;

import controller.Controller;
import controller.IState;
import controller.Controller.StateType;

/*
 * 
 * RestartLevelState class
 * 
 * State used when the current level must be restarted (after player death).
 * When the user presses the Enter key the game enters the GamePlayState.
 * 
 */

public class RestartLevelState implements IState {

	Controller controller;
	public StateType state;

	/**
	 * RestartLevelState
	 * 
	 * creates the RestartLevelState based upon the passed in controller
	 * 
	 * @param c
	 */
	public RestartLevelState(Controller c) {
		controller = c;
		state = StateType.RESTART_LEVEL;
	}

	/* (non-Javadoc)
	 * @see controller.IState#getState()
	 */
	@Override
	public StateType getState() {
		return state;
	}

	/* (non-Javadoc)
	 * @see controller.IState#handleKeyPressed(int)
	 */
	@Override
	public void handleKeyPressed(int keyCode) {
		return;
	}

	/* (non-Javadoc)
	 * @see controller.IState#handleKeyReleased(int)
	 */
	@Override
	public void handleKeyReleased(int keyCode) {
		if (keyCode == 10) {
			controller.setState(new GameplayState(controller));
		}
	}

}
